package br.unb.cdt.dao;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public abstract class DataAccessObject {
	
	private static SessionFactory factory = null;
	
	private static void initSessionFactory() {
		if(factory == null)
			factory = new Configuration().configure().buildSessionFactory();	
	}

	public static Session createSession() {
		initSessionFactory();
		Session session = factory.openSession();
		return session;
	}
	
	
	
}
